<template>
  <div class="house" @click="$router.push(`/house/detail/${item.houseCode}`)">
    <div class="imgWrap">
      <img class="img" :src="url+ item.houseImg" alt>
    </div>
    <div class="content">
      <h3 class="title">{{item.title}}</h3>
      <div class="desc">{{item.desc}}</div>
      <div class="tags">
        <span :class="['tag','tag'+(index+1)]" v-for="(tag,index) in item.tags ">{{tag}}</span>
      </div>
      <div></div>
      <div class="price">
        <span class="priceNum">{{item.price}}</span> 元/月
      </div>
    </div>
  </div>
</template>

<script>
import { url } from "../utils/index.js";
export default {
  props: {
    item: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      url: url
    };
  }
};
</script>

<style lang="less" scoped>
/* 房屋列表项样式 */
.house {
  height: 120px;
  position: relative;
  display: flex;
  padding-top: 18px;
  border-bottom: 1px solid #e5e5e5;
  padding-left: 12px;
  .content {
    overflow: hidden;
    line-height: 22px;
    padding-left: 12px;
    .title {
      padding: 0;
      margin: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      vertical-align: middle;
      font-size: 15px;
      color: #394043;
    }
    .desc {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      vertical-align: middle;
      font-size: 12px;
      color: #afb2b3;
    }
    .price {
      font-size: 12px;
      color: #fa5741;
      font-weight: 600;
    }
    .tags {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .tag {
      display: inline-block;
      font-size: 12px;
      border-radius: 3px;
      padding: 4px 5px;
      margin-right: 5px;
      line-height: 12px;
    }
    .tag1 {
      color: #39becd;
      background: #e1f5f8;
    }
    .tag2 {
      color: #3fc28c;
      background: #e1f5ed;
    }
    .tag3 {
      color: #5aabfd;
      background: #e6f2ff;
    }
    .tag4 {
      color: #ff009d;
      background: #bda7fc;
    }
    .tag5 {
      color: #00ff80d7;
      background: #2fdd72;
    }
    .tag6 {
      color: #ae00ff;
      background: #3f93a0;
    }
  }
  .img {
    width: 106px;
    height: 80px;
  }
}
</style>
